package site.edody.dframe.ssoserver;

import cn.dev33.satoken.sso.template.SaSsoServerTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.ssssssss.magicapi.core.service.MagicAPIService;


/**
 * 重写以增强配置
 */
@Component
public class SysSsoServerTemplate extends SaSsoServerTemplate {


    private final Logger log = LoggerFactory.getLogger(SysSsoServerTemplate.class);

    @Autowired
    MagicAPIService service;

    @Override
    public String getAllowUrl (){
        String rs = "";
        try{
            Object value = service.invoke("/ssocoinfig/getssoclient", null);
            rs = value.toString();
            log.info("allow SSO client: {" + rs+"}");
        } catch(Exception e){
            log.error("配置allow url 异常： "+e);
        }

        return rs;
    }

}
